﻿<%@ Page EnableViewState="true" Language="C#" MasterPageFile="~/master/ThreeColumnLayout.master"
    AutoEventWireup="true" CodeFile="AdminMessagebox.aspx.cs" Inherits="page_private_user_messagebox"
    Title="Untitled Page" %>

<asp:Content ID="Content1" ContentPlaceHolderID="LeftPlaceHolder" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MiddlePlaceHolder" runat="Server">

    <script language="javascript">

 function SelectAllCheckboxes(spanChk){
   // http://www.codeproject.com/KB/webforms/SelChkboxesDataGridView.aspx
   // Added as ASPX uses SPAN for checkbox
   var oItem = spanChk.children;
   var theBox= (spanChk.type=="checkbox") ? 
        spanChk : spanChk.children.item[0];
   xState=theBox.checked;
   elm=theBox.form.elements;

   for(i=0;i<elm.length;i++)
     if(elm[i].type=="checkbox" && 
              elm[i].id!=theBox.id)
     {
       //elm[i].click();
       if(elm[i].checked!=xState)
         elm[i].click();
       //elm[i].checked=xState;
     }
 }

</script>
<script type="text/javascript" src="\fashionzoomer\thirdparty\wz_tooltip\wz_tooltip.js"></script>

    <asp:Label ID="lblHeader" runat="server" SkinID="EmptyDataMessage" Text="MyInbox"></asp:Label>
    <asp:TextBox ID="txtSearchBox" runat="server" Height="23px" Width="108px"></asp:TextBox>
&nbsp;<asp:Button ID="btnMailSearch" runat="server" Height="23px" 
        onclick="btnMailSearch_Click" Text="Mail Search" Width="108px" />
&nbsp;<asp:GridView  DataKeyNames="id" ID="GVMessageBox" runat="server" AutoGenerateColumns="False"
        Height="17px" AllowPaging="True" AllowSorting="True" BackColor="White" BorderColor="#CC9966"
        BorderStyle="None" BorderWidth="1px" CellPadding="4"
        OnRowDataBound="GVMessageBox_RowDataBound" Width="622px" 
        SkinID="AdminList">

        <FooterStyle BackColor="#FFFFCC" ForeColor="#330099" />
        <RowStyle BackColor="White" ForeColor="#330099" />
        <Columns>
            <asp:TemplateField HeaderText="">
                <ItemTemplate>
                    <asp:CheckBox ID="chkSelect" runat="server" />
                    <asp:HiddenField runat="server" ID="isRead" Value='<%#DataBinder.Eval(Container.DataItem, "is_read")%>' />
                </ItemTemplate>
                <HeaderTemplate>
                    <input id="chkAll" onclick="javascript:SelectAllCheckboxes(this);" runat="server"
                        type="checkbox" />
                </HeaderTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="From">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Image ID="imgMailBox" runat="server" />
                    <asp:Label ID="Label1" Text='<%# DataBinder.Eval(Container.DataItem, "user_name")%>'
                        runat="server"></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Message">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <div style="visibility:hidden; background-color:Gray"  id="hdTip<%# DataBinder.Eval(Container.DataItem, "id")%>" >
                    <%#GetTextToPreview(DataBinder.Eval(Container.DataItem, "message_body"))%>
                    </div>
                    <asp:Literal ID="Literal1" runat="server" Text='<%#SetMessageLink(DataBinder.Eval(Container.DataItem, "message_body"),DataBinder.Eval(Container.DataItem, "id"),DataBinder.Eval(Container.DataItem, "user_email"))%>'></asp:Literal>
                </ItemTemplate>
                <ControlStyle Width="200px" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Date">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label3" Text='<%# DataBinder.Eval(Container.DataItem, "when_sent")%>'
                        runat="server"></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
        <PagerStyle BackColor="#FFFFCC" ForeColor="#330099" HorizontalAlign="Center" />
        <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="#663399" />
        <HeaderStyle BackColor="#F4A460" Font-Bold="True" ForeColor="#FFFFCC" />
    </asp:GridView>
    <asp:Button ID="BtnDelete" runat="server" Text="Delete" OnClick="BtnDelete_Click" />
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="RightPlaceHolder" runat="Server">
</asp:Content>
